<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>iOS AR和ARKit4 | MoneyLee’s Blog</title><meta name="author" content="李财"><meta name="copyright" content="李财"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="ARKit 4 简介iPadOS 上的 ARKit 4 推出了全新的景深 API，创造了一种新的方式来访问由 iPad Pro 上的激光雷达扫描仪收集的详细深度信息。位置锚定功能利用 Apple 地图中更高分辨率的数据，能在您的 iPhone 和 iPad app 中将增强现实体验放置在世界的特定地方。此外，对面部跟踪的支持扩展到所有配备 Apple 神经网络引擎和前置摄像头的设备，让更多用户能在">
<meta property="og:type" content="article">
<meta property="og:title" content="iOS AR和ARKit4">
<meta property="og:url" content="https://moneylee.gitee.io/blog/2020/08/19/iOS%20AR%E5%92%8CARKit4/index.html">
<meta property="og:site_name" content="MoneyLee’s Blog">
<meta property="og:description" content="ARKit 4 简介iPadOS 上的 ARKit 4 推出了全新的景深 API，创造了一种新的方式来访问由 iPad Pro 上的激光雷达扫描仪收集的详细深度信息。位置锚定功能利用 Apple 地图中更高分辨率的数据，能在您的 iPhone 和 iPad app 中将增强现实体验放置在世界的特定地方。此外，对面部跟踪的支持扩展到所有配备 Apple 神经网络引擎和前置摄像头的设备，让更多用户能在">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://tva1.sinaimg.cn/large/006y8mN6ly1g8vl0019wlj31ej0u0x6q.jpg">
<meta property="article:published_time" content="2020-08-19T02:04:03.000Z">
<meta property="article:modified_time" content="2020-08-27T12:14:24.000Z">
<meta property="article:author" content="李财">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://tva1.sinaimg.cn/large/006y8mN6ly1g8vl0019wlj31ej0u0x6q.jpg"><link rel="shortcut icon" href="/blog/img/favicon.png"><link rel="canonical" href="https://moneylee.gitee.io/blog/2020/08/19/iOS%20AR%E5%92%8CARKit4/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/blog/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/blog/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'iOS AR和ARKit4',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2020-08-27 20:14:24'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/blog/atom.xml" title="MoneyLee’s Blog" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://i.loli.net/2019/11/10/SYvXMgCFuTNOVeZ.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">47</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fa fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fa fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/bbs/"><i class="fa-fw fa fa-coffee"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/blog/link/"><i class="fa-fw fa fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fa fa-heart"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa fa-list"></i><span> 影音</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/blog/music"><i class="fa-fw /music/"></i><span> 0</span></a></li><li><a class="site-page child" href="/blog/movies"><i class="fa-fw /movies/"></i><span> 1</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://tva1.sinaimg.cn/large/006y8mN6ly1g8vl0019wlj31ej0u0x6q.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/blog/">MoneyLee’s Blog</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fa fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fa fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/bbs/"><i class="fa-fw fa fa-coffee"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/blog/link/"><i class="fa-fw fa fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fa fa-heart"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa fa-list"></i><span> 影音</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/blog/music"><i class="fa-fw /music/"></i><span> 0</span></a></li><li><a class="site-page child" href="/blog/movies"><i class="fa-fw /movies/"></i><span> 1</span></a></li></ul></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">iOS AR和ARKit4</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-08-19T02:04:03.000Z" title="发表于 2020-08-19 10:04:03">2020-08-19</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2020-08-27T12:14:24.000Z" title="更新于 2020-08-27 20:14:24">2020-08-27</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/blog/categories/iOS/">iOS</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="iOS AR和ARKit4"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="ARKit-4-简介"><a href="#ARKit-4-简介" class="headerlink" title="ARKit 4 简介"></a>ARKit 4 简介</h2><p>iPadOS 上的 ARKit 4 推出了全新的景深 API，创造了一种新的方式来访问由 iPad Pro 上的激光雷达扫描仪收集的详细深度信息。位置锚定功能利用 Apple 地图中更高分辨率的数据，能在您的 iPhone 和 iPad app 中将增强现实体验放置在世界的特定地方。此外，对面部跟踪的支持扩展到所有配备 Apple 神经网络引擎和前置摄像头的设备，让更多用户能在照片和视频中体验到增强现实的乐趣。</p>
<p>###创建项目</p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzb1hc92mj314k0swn0e.jpg" alt="image-20200822085503314"></p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzbazmojaj313o0rs0wo.jpg" alt="image-20200822090411080"></p>
<p>这几种区别</p>
<p><strong>Metal</strong> 是最基础的 适合熟练使用的开发者  可以个性化定义</p>
<p><strong>SpriteKit</strong> 2D模型</p>
<p><strong>SceneKit</strong> 3D模型  支持iOS11.0以上系统，iphone 6s以上手机（即iphone8,1以上）</p>
<p><strong>RealityKit</strong> 支持人体追踪  支持iOS13.0以上系统，iphone xs以上手机（即iphone11,2以上）</p>
<p>创建工程获得实例工程</p>
<p>示例工程内的 ARConfiguration</p>
<p><code>let configuration = ARWorldTrackingConfiguration()</code></p>
<p><strong>ARConfiguration</strong>包含多种配置类型:</p>
<p><strong>ARWorldTrackingConfiguration</strong>: 世界跟踪配置（6DOF），只能使用后置摄像头，需要iOS 11以上。</p>
<p><strong>AROrientationTrackingConfiguration</strong>: 使用后置摄像头并仅跟踪设备方向的配置</p>
<p><strong>ARFaceTrackingConfiguration</strong>: 人脸跟踪配置，只能使用前置的TrueDepth摄像头，需要iOS 11以上</p>
<p><strong>ARImageTrackingConfiguration</strong>: 图像跟踪配置，只能使用后置摄像头，需要iOS 12以上。</p>
<p>ARObjectScanningConfiguration: 提供使用后置摄像头收集现实空间数据，创建参考对象以便在其他AR体验中进行检测（把现实世界的物体解析成3D模型）</p>
<p><strong>ARBodyTrackingConfiguration</strong>: 人体跟踪配置，只能使用后置摄像头，需要iOS 13以上和A12芯片</p>
<p><strong>ARPositionalTrackingConfiguration</strong>:定位跟踪配置，仅跟踪设备在空间中的位置，使用后置摄像头，需要iOS 13以上。</p>
<p><strong>ARGeoTrackingConfiguration</strong>:地理位置跟踪配置，使用GPS、设备指南针和地图数据跟踪感兴趣的地理位置，需要iOS 14以上。</p>
<p><strong>注：</strong>可以同时在前置摄像头上使用面部跟踪，在后置摄像头使用世界跟踪。例如，用户可以只使用他们的脸部与后置摄像头画面中的AR内容进行交互。</p>
<hr>
<h3 id="判别用户手机是否支持"><a href="#判别用户手机是否支持" class="headerlink" title="判别用户手机是否支持"></a>判别用户手机是否支持</h3><p>因为我们创建项目的时候是个预置AR的项目 所以初始化项目的时候,已经为我们配置到了,在info.plist内 如果用户手机不支持会下载不了此项目 armv7 是对处理器的要求 A9处理器以上</p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzc5w1y7nj30zu0e6jti.jpg" alt="image-20200822093353291"></p>
<hr>
<h4 id="模型参数-坐标-旋转-模型渲染材质-贴纸"><a href="#模型参数-坐标-旋转-模型渲染材质-贴纸" class="headerlink" title="模型参数 坐标 旋转 模型渲染材质 贴纸"></a>模型参数 坐标 旋转 模型渲染材质 贴纸</h4><p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzcxbvh9jj31fe0u04qp.jpg" alt="image-20200822100012737"></p>
<p>创建一个红色球体 放在屏幕中央 拒摄像头0.5米</p>
<p><a target="_blank" rel="noopener" href="https://www.solarsystemscope.com/textures/">星球贴纸网站 可以下载贴纸</a></p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzddm8kh4j30pu0iatey.jpg" alt="image-20200822101554417"></p>
<p>将下载的贴纸图片导入项目 选择4K 还是8K</p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzdf831cfj31f80u04i2.jpg" alt="image-20200822101727098"></p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzdl2dscaj30u01sztbt.jpg" alt="6501598062963_.pic"></p>
<hr>
<h4 id="动态创建AR地球-SCNNode-SCNGeometry"><a href="#动态创建AR地球-SCNNode-SCNGeometry" class="headerlink" title="动态创建AR地球+SCNNode+SCNGeometry"></a>动态创建AR地球+SCNNode+SCNGeometry</h4><figure class="highlight swift"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//实例化一个几何图形 球</span></span><br><span class="line"><span class="keyword">let</span> sphere <span class="operator">=</span> <span class="type">SCNSphere</span>(radius: <span class="number">0.2</span>)</span><br><span class="line"><span class="comment">//设置贴纸 全路径</span></span><br><span class="line">sphere.firstMaterial<span class="operator">?</span>.diffuse.contents <span class="operator">=</span> <span class="type">UIImage</span>(named: <span class="string">&quot;art.scnassets/2k_earth_nightmap.jpg&quot;</span>)</span><br><span class="line"><span class="comment">//模型</span></span><br><span class="line"><span class="keyword">let</span> node <span class="operator">=</span> <span class="type">SCNNode</span>(geometry: sphere)</span><br><span class="line"><span class="comment">//设置位置</span></span><br><span class="line">node.position <span class="operator">=</span> <span class="type">SCNVector3</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="operator">-</span><span class="number">0.5</span>)</span><br><span class="line"></span><br><span class="line">sceneView.scene.rootNode.addChildNode(node)</span><br></pre></td></tr></table></figure>

<hr>
<h4 id="用Xcode把3D模型文件转化为-scn文件"><a href="#用Xcode把3D模型文件转化为-scn文件" class="headerlink" title="用Xcode把3D模型文件转化为.scn文件"></a>用Xcode把3D模型文件转化为.scn文件</h4><p><a target="_blank" rel="noopener" href="https://www.turbosquid.com/">3D模型库</a> 需要注册使用, 有收费的和免费的模型</p>
<p><a target="_blank" rel="noopener" href="https://www.blender.org/">3D模型制作工具Blender</a></p>
<p>SceneKit支持哪些模型呢 <a target="_blank" rel="noopener" href="https://developer.apple.com/documentation/scenekit/scnscenesource">官方文档</a></p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghze96mbtzj311k0jg0v6.jpg" alt="image-20200822104614540"></p>
<p>只有 .dae是一种比较主流的3D模型格式 但是在主流的模型文件中占比比较少</p>
<p>所以苹果为了让我们找到更多现成的模型 在ARKit2中加入了 usdz模型, 我们可以通过Xcode将当前最主流的模型转换成usdz,供我们使用. 当前最主流的是 .obj格式的模式. 所以可说成我们只支持两种 .dae和.obj  obj需要转换下</p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzeiise8uj31os0sg4qp.jpg" alt="image-20200822105512740"></p>
<p>找一个免费的 .dae格式模型下载下来</p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzesmy83pj31o80rqgs1.jpg" alt="image-20200822110456588"></p>
<p>这里注意有的好的收费的 模型和贴纸是打包好的 这里的需要单独下载</p>
<p>将dae和贴纸文件导入项目</p>
<p>即使支持dae文件但是我们依旧需要用xcode将文件格式转换成.scn 因为后续有些操作会执行不了, 代码也会给我们提示 所以为了安全方便还是转换下 也很简单</p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzf6q7nuvj31f10u04qp.jpg" alt="image-20200822111827966"></p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzfdo6uqvj31ph0u01kx.jpg" alt="image-20200822112509597"></p>
<p>贴纸是多张dds格式的不要慌 iOS支持 然后看图中箭头所指 将对应的贴纸给粘贴上</p>
<p>注意: 如果在使用转换完的.scn模型后运行报错: <img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzjk1wzcpj31fc07ogpd.jpg" alt="BF95A0BBD9044A89164A7B71A1217873"></p>
<p>不要慌 解决办法</p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzjktjhz7j30su0ko7e2.jpg" alt="image-20200822135025951"></p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzjlce3nyj31pt0u0nf7.jpg" alt="image-20200822135055681"></p>
<p>选择个版本就好了, 我之前就遇到这个问题, google了一下才找到原因所在</p>
<p>效果图</p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlly1ghzkshdj2tj30u01sztde.jpg" alt="6551598077912_.pic"></p>
<hr>
<h4 id="将-obj文件转化成-scn文件使用"><a href="#将-obj文件转化成-scn文件使用" class="headerlink" title="将.obj文件转化成.scn文件使用"></a>将.obj文件转化成.scn文件使用</h4><p>我们在转换.obj文件时要多一步 不能直接通过工具Convert</p>
<p>没有可视化转换界面 需要终端命令行操作</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">xcrun usdz_converter /Users/moneylee/Downloads/ArmyTruck_OBJ/armytruck.obj /Users/moneylee/Downloads/truck.usdz</span><br><span class="line">xcrun: error: sh -c &#x27;/Applications/Xcode-beta.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find usdz_converter 2&gt; /dev/null&#x27; failed with exit code 17664: (null) (errno=No such file or directory)</span><br><span class="line">xcrun: error: unable to find utility &quot;usdz_converter&quot;, not a developer tool or in PATH</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>OMG  usdz_converter 已经被启用了, 我Xcode10版本应该是可用的, 我的是12 所以需要换种方式</p>
<p>在这里下载 <code>https://developer.apple.com/download/more/?=USDPython</code></p>
<p>USDPython 基与python的工具 用于生成,验证和检查usdz文件 包括一个转换器 这个转换器可以从其他3D格式文件以及Pixar和USD库和示例脚本中创建usdz</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">李财</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://moneylee.gitee.io/blog/2020/08/19/iOS%20AR%E5%92%8CARKit4/">https://moneylee.gitee.io/blog/2020/08/19/iOS%20AR%E5%92%8CARKit4/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://moneylee.gitee.io/blog" target="_blank">MoneyLee’s Blog</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="https://tva1.sinaimg.cn/large/006y8mN6ly1g8vl0019wlj31ej0u0x6q.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/blog/2020/08/19/Flutter/"><img class="prev-cover" src="https://tva1.sinaimg.cn/large/006y8mN6ly1g8vl0019wlj31ej0u0x6q.jpg" onerror="onerror=null;src='/blog/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Flutter</div></div></a></div><div class="next-post pull-right"><a href="/blog/2020/08/18/Docker%E9%83%A8%E7%BD%B2SpringBoot%E9%A1%B9%E7%9B%AE/"><img class="next-cover" src="https://tva1.sinaimg.cn/large/006y8mN6ly1g8vl4zhjzuj30qy0e0gyz.jpg" onerror="onerror=null;src='/blog/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Docker 部署 SpringBoot 项目</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://i.loli.net/2019/11/10/SYvXMgCFuTNOVeZ.png" onerror="this.onerror=null;this.src='/blog/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">李财</div><div class="author-info__description">嗨，我是李财 (MoneyLee)， 一名来自中国的 iOS开发者。</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">47</div></a></div><div class="card-info-data-item is-center"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/licai28" target="_blank" title=""><i class="fa fa-github"></i></a><a class="social-icon" href="mailto:licai_1024@hotmail.com" target="_blank" title=""><i class="fa fa-envelope"></i></a><a class="social-icon" href="/blog/img/mywechat.jpg" target="_blank" title=""><i class="fa fa-weixin"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#ARKit-4-%E7%AE%80%E4%BB%8B"><span class="toc-number">1.</span> <span class="toc-text">ARKit 4 简介</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%88%A4%E5%88%AB%E7%94%A8%E6%88%B7%E6%89%8B%E6%9C%BA%E6%98%AF%E5%90%A6%E6%94%AF%E6%8C%81"><span class="toc-number">1.1.</span> <span class="toc-text">判别用户手机是否支持</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%A8%A1%E5%9E%8B%E5%8F%82%E6%95%B0-%E5%9D%90%E6%A0%87-%E6%97%8B%E8%BD%AC-%E6%A8%A1%E5%9E%8B%E6%B8%B2%E6%9F%93%E6%9D%90%E8%B4%A8-%E8%B4%B4%E7%BA%B8"><span class="toc-number">1.1.1.</span> <span class="toc-text">模型参数 坐标 旋转 模型渲染材质 贴纸</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8A%A8%E6%80%81%E5%88%9B%E5%BB%BAAR%E5%9C%B0%E7%90%83-SCNNode-SCNGeometry"><span class="toc-number">1.1.2.</span> <span class="toc-text">动态创建AR地球+SCNNode+SCNGeometry</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%94%A8Xcode%E6%8A%8A3D%E6%A8%A1%E5%9E%8B%E6%96%87%E4%BB%B6%E8%BD%AC%E5%8C%96%E4%B8%BA-scn%E6%96%87%E4%BB%B6"><span class="toc-number">1.1.3.</span> <span class="toc-text">用Xcode把3D模型文件转化为.scn文件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%B0%86-obj%E6%96%87%E4%BB%B6%E8%BD%AC%E5%8C%96%E6%88%90-scn%E6%96%87%E4%BB%B6%E4%BD%BF%E7%94%A8"><span class="toc-number">1.1.4.</span> <span class="toc-text">将.obj文件转化成.scn文件使用</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/blog/2021/09/14/Flutter%20%E5%90%AF%E5%8A%A8%E9%A1%B5%E9%85%8D%E7%BD%AE/" title="无题"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="无题"/></a><div class="content"><a class="title" href="/blog/2021/09/14/Flutter%20%E5%90%AF%E5%8A%A8%E9%A1%B5%E9%85%8D%E7%BD%AE/" title="无题">无题</a><time datetime="2021-09-14T03:05:25.000Z" title="发表于 2021-09-14 11:05:25">2021-09-14</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2020/08/21/iOS%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/" title="iOS机器学习"><img src="https://tva1.sinaimg.cn/large/006y8mN6ly1g8vl0019wlj31ej0u0x6q.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="iOS机器学习"/></a><div class="content"><a class="title" href="/blog/2020/08/21/iOS%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/" title="iOS机器学习">iOS机器学习</a><time datetime="2020-08-21T02:04:10.000Z" title="发表于 2020-08-21 10:04:10">2020-08-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2020/08/20/Docker%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E6%95%B4%E7%90%86/" title="Docker 基础知识整理"><img src="https://tva1.sinaimg.cn/large/006y8mN6ly1g8vl4zhjzuj30qy0e0gyz.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="Docker 基础知识整理"/></a><div class="content"><a class="title" href="/blog/2020/08/20/Docker%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E6%95%B4%E7%90%86/" title="Docker 基础知识整理">Docker 基础知识整理</a><time datetime="2020-08-20T12:12:02.000Z" title="发表于 2020-08-20 20:12:02">2020-08-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2020/08/19/Flutter/" title="Flutter"><img src="https://tva1.sinaimg.cn/large/006y8mN6ly1g8vl0019wlj31ej0u0x6q.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="Flutter"/></a><div class="content"><a class="title" href="/blog/2020/08/19/Flutter/" title="Flutter">Flutter</a><time datetime="2020-08-19T02:04:03.000Z" title="发表于 2020-08-19 10:04:03">2020-08-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2020/08/19/iOS%20AR%E5%92%8CARKit4/" title="iOS AR和ARKit4"><img src="https://tva1.sinaimg.cn/large/006y8mN6ly1g8vl0019wlj31ej0u0x6q.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="iOS AR和ARKit4"/></a><div class="content"><a class="title" href="/blog/2020/08/19/iOS%20AR%E5%92%8CARKit4/" title="iOS AR和ARKit4">iOS AR和ARKit4</a><time datetime="2020-08-19T02:04:03.000Z" title="发表于 2020-08-19 10:04:03">2020-08-19</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By 李财</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/blog/js/utils.js"></script><script src="/blog/js/main.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>